from .. import db
from datetime import datetime


class RedeemCode(db.Model):
    __tablename__ = 'redeem_code'
    id = db.Column(db.Integer, primary_key=True)
    redeem_code = db.Column(db.String(50), nullable=True)
    app_name = db.Column(db.String(20), nullable=True)
    vip_type = db.Column(db.String(10), nullable=True)
    vip_cycle = db.Column(db.String(10), nullable=True)
    use_status = db.Column(db.Integer, default=0)
    create_at = db.Column(db.DateTime, default=datetime.now())
    __table_args__ = (db.UniqueConstraint('redeem_code', 'app_name', 'vip_type', 'vip_cycle'), )
